import matplotlib.pyplot as plt
import pandas as pd
df = pd.read_excel('超市销售信息表.xlsx')
plt.boxplot(df['购物体验评分'], positions=[1])
plt.boxplot(df['购物体验评分'], positions=[2], notch=True, whis=0.5, patch_artist=True, boxprops={'facecolor': 'r'}, showmeans=True)
Q1 = df['购物体验评分'].describe()['75%']
Q2 = df['购物体验评分'].describe()['25%']
up_limit = Q1 + (Q1 - Q2) * 0.5
low_limit = Q2 - (Q1 - Q2) * 0.5
val = df['购物体验评分'][(df['购物体验评分'] > up_limit) | (df['购物体验评分'] < low_limit)]
print('购物体验评分的统计值：\n', df['购物体验评分'].describe())
print('whis为0.5时异常值：\n', val)
plt.show()
